package com.jt.sp04orderservice.feign;

import com.jt.sp01.entity.User;
import com.jt.web.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户服务远程调用
 * @author 郭鲁政
 */
@FeignClient(name = "user-service")
public interface UserClient {
    /**
     * 根据用户id查询用户信息
     * @param userId 用户id
     * @return 用户信息
     */
    @GetMapping("/{userId}")
    JsonResult<User> getUser(@PathVariable(name = "userId") Integer userId);

    /**
     * 根据用户id添加积分
     * @param userId 用户id
     * @param score 添加的积分 ?scope=1000
     * @return
     */
    @GetMapping("/{userId}/score")
    JsonResult<?> addScore(@PathVariable(name = "userId") Integer userId,@RequestParam(name = "score") Integer score);
}
